//
//  SongPicAndLrcView.m
//  WXMusic
//
//  Created by 漫步人生路 on 15/9/6.
//  Copyright (c) 2015年 漫步人生路. All rights reserved.
//

#import "SongPicAndLrcView.h"

@implementation SongPicAndLrcView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.pagingEnabled = YES;
        self.scrollEnabled = YES;
        self.directionalLockEnabled = YES;
        self.bounces = NO;
        self.showsHorizontalScrollIndicator = NO;
        self.contentSize = CGSizeMake(kWidth * 2, 0);
        self.songPicView = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth / 12, kHeight / 10, kWidth / 1.2, kWidth / 1.2)];
        [self setUpSongPicView:self.songPicView];
        self.lrcView = [[UITableView alloc]initWithFrame:CGRectMake(kWidth, 0, kWidth, self.bounds.size.height) style:UITableViewStylePlain];
        self.lrcView.backgroundColor = [UIColor clearColor];
        [self addSubview:self.lrcView];
    }
    return self;
}
- (void)setUpSongPicView:(UIImageView *)songPicView
{
    songPicView.layer.masksToBounds = YES;
    songPicView.layer.borderWidth = 2;
    songPicView.layer.cornerRadius = songPicView.bounds.size.height / 2;
    songPicView.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self addSubview:songPicView];
}

- (void)setTaget:(id)taget image:(NSString *)image
{
    self.lrcView.delegate = taget;
    self.lrcView.dataSource = taget;
    self.lrcView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.songPicView sd_setImageWithURL:[NSURL URLWithString:image] placeholderImage:[UIImage imageNamed:@"ic_blank_collect"]];
    
}
@end
